﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System.Windows.Forms;

namespace AutoExecuteSp
{
    public class ScriptLogger
    {
        public void Log(List<ExecuteResult> executeResults)
        {
            BinaryFormatter binaryFormatter = new BinaryFormatter();

            using (FileStream fs = File.Create(Application.StartupPath + "//log.eqs"))
            {
                binaryFormatter.Serialize(fs, executeResults);
                fs.Close();
            }

            foreach (var executeResult in executeResults)
            {
                if (!executeResult.IsSuccess)
                    Console.WriteLine("Failed ,{0}", executeResult.FileInfo.FullName);
            }
        }
    }
}
